252
S. Das et al.
Hash Selection Algorithm:
Input- Block
Output- Hash of the block
1: procedure Hash Selection
2: If exist(token)=False then
3:
token = Token Generation ()
4: end if
5: if token == T1 then
6:
return Hash_Algo_1(block)
7: else if token ==T2 then
8:
return Hash_Algo_2 (block)
9: else if token ==T2 then
10: return Hash_Algo_3(block)
11: else
12: return Hash_Algo_4(block)
13: end if
14: end procedure
Algorithm for Hash Selection
Block Mining Algorithm:
Input- Block
Output- Chain of Blocks
1: procedure Block Mining
2: for n = 1 to Range, (incrementing n by +1 upto maxNonce) do
3: if Hash Selection(block)<= target then
4: add(block)
5: else
6: nonce_block = Random_nonce()
7: end if
8: end for
9: end procedure
10: end if
11: end procedure
Algorithm for Block Mining
As previously mentioned, in certain use cases, the usage of multiple different
hash functions within the same network can cause hindrances. In these use cases,
an alternate process is used. In the consensus algorithm, there is no hash algorithm
selection and a fixed hash algorithm is used for all tiers of devices. Instead, a target